#include <iostream>
#include <future>
#include <chrono>

using namespace std::chrono;

// char stop_flag;

//int testFutureVaild() 
int main() 
{

	std::future<void> f1 = std::async([&]() {
		
		std::cout << "f1 is running!\n";
		//Sleep(1000);
		std::this_thread::sleep_for(milliseconds(1000));
		std::cout << "f1 is running!\n";

		});

	if (f1.valid())
		std::cout << "f1 is valid.\n";
	else
		std::cout << "f1 is quit.\n";

	f1.get();

	if (f1.valid())
		std::cout << "f1 is valid.\n";
	else
		std::cout << "f1 is quit.\n";
	
	return 0;
}
